@extends('home.layout.layout')
@section('tittle','个人中心')
@section('css')
	<link rel="stylesheet" type="text/css" href="{{asset('/HomeCss/css/common.css')}}"/>
	<link rel="stylesheet" type="text/css" href="{{asset('/HomeCss/css/index.css')}}">
	<link rel="stylesheet" type="text/css" href="{{asset('/HomeCss/css/ucenter.css')}}">	
	<link type="text/css" rel="stylesheet" href="/HomeCss/css/common_product_event.css" />
	<script src="/HomeCss/js/jquery.js" type="text/javascript"></script>
	<script src="/HomeCss/js/jquery.form.js" type="text/javascript"></script>
	<style type="text/css">
		body{position: relative}
		.t-fkcon{margin: 0 auto;width: 860px;font-family: 'Microsoft YaHei'}
		.t-fkheader {padding-left: 50px}
		.t-fkheader span{color: #757575;font-size: 14px;}
		.t-fktit{background: #f7f7f7;width: 754px;height: 68px;line-height: 68px;margin: 0 auto;text-align: center;font-size: 30px;color: #4e4e4e;margin-top: 40px}
		.t-fkratit{padding-left: 50px;font-size: 14px;color: #333;margin-top: 30px}
		.t-fkra{padding-left: 50px;font-size: 12px;color: #666;margin-top: 20px}
		.t-fkra input{margin-right: 5px}
		.t-fkra label{margin-right: 80px}
		.t-fktxt{padding-left: 50px;margin-top: 10px;position: relative}
		.t-fktxt textarea{width: 752px;height: 200px;text-align: left;line-height: 20px;resize:none;overflow-y:auto}
		#t-submitFk{background: url(/HomeCss/images/fk.png) no-repeat 0 0;width: 107px;height: 33px;border: none;cursor: pointer;color: #fff;vertical-align: top}
		#t-submitFk:hover{background: url(/HomeCss/images/fk.png) no-repeat 0 -33px}
		#t-deltxt{background: url(/HomeCss/images/fk.png) no-repeat 0 -66px;width: 72px;height: 33px;cursor: pointer;border: none;vertical-align: top;color: #4f4f4f;margin-left: 5px}
		.t-fksubmit{text-align: right;padding-right: 54px;margin-top: 10px}
		.t-fkback{position: absolute;width: 100%;height: 650px;top: 0;left: 0;display: none}
		.t-refk{position: absolute;top: 30px;left: 30%;z-index: 1000;height: 70px;width: 300px;display: none;background: #fff;padding: 30px;line-height: 25px;border: 5px solid #000;-moz-border-radius: 5px;  -webkit-border-radius: 5px; }
		.t-refk input{margin-left: 10px;height: 24px;width: 80px}
		.validate_img{vertical-align: bottom;}
		.t-fkyan{padding-left: 50px}
		.authCodeInput{height: 24px;line-height: 24px;width: 70px;padding-left: 2px;font-size: 14px}
		.t-refk input.t-qd{margin-left: 150px;width: 54px}
		#checklen{font-size: 14px;text-align: right;width: 758px;display: block;}
		.timefktop{padding: 40px 0 20px 0;width: 350px;text-align: center}
		.timefk{padding: 0 20px 40px 0;width: 300px;text-align: right;}
	</style>
@endsection

@section('con')
</head>
<body>
	<div class="t-fkback"></div>
		<div class="ucenter">
    <div class="leftnnav">
    <dl>
        <dt>订单中心</dt>
        <dd><a href="/order/lists" title="我的订单">我的订单</a></dd>
        <dd><a href="/order/lists/c" title="评价晒单">评价晒单</a></dd>
    </dl>
    <dl>
        <dt>个人中心</dt>
        <dd><a href="/installment/index" title="我的好乐买分期">我的好乐买分期</a></dd>
        <dd><a href="{{asset('/home/collect/index')}}" title="我的收藏">我的收藏</a></dd>
        <dd><a href="/member/mycoupon" title="我的优惠券">我的优惠券</a></dd>
        <dd><a href="/member/integral" title="我的积分">我的积分</a></dd>
        <dd><a href="/memberaddress/address" title="收货地址管理">收货地址管理</a></dd>
        <dd><a href="/member/realname_identify" title="实名认证">实名认证</a></dd>
                    <dd><a href="{{asset('/home/umessage/index')}}" title="账号安全">账号安全</a></dd>
                <dd><a href="/inbox/index" title="我的消息">我的消息</a></dd>
    </dl>
    <dl>
        <dt>客户服务</dt>
        <dd><a href="{{asset('/home/umessage/member')}}" class='cur' title="用户反馈">用户反馈</a></dd>
        <dd><a href="{{asset('/home/umessage/liuyan')}}"  title="查看反馈">查看反馈</a></dd>
    </dl>
</div>
</div>

	<div class="t-fkcon" style='border-radius:10px;'>
	<form action="/home/umessage/save" method="post" id="feedbackForm" >
	
	<div class="t-fktit" >
		<a href="/" style='float:left;' title=""><img  src="/HomeCss/picture/miniheaderlogo.png" height="65" width="138" alt=""></a>
		<span>好乐买用户反馈表</span>
	</div>
	<p class="t-fkratit">请选择您反馈问题的类型：</p>
	<p class="t-fkra">
	<input type="radio" name="type" id="fkq_2" value="2" checked><label for="fkq_2">优化与建议</label>
	<input type="radio" name="type" id="fkq_3" value="3" ><label for="fkq_3">订单支付</label>
	<input type="radio" name="type" id="fkq_4" value="4"><label for="fkq_4">物流配送</label>
	<input type="radio" name="type" id="fkq_5" value="5"><label for="fkq_5">退换货办理</label>
	<input type="radio" name="type" id="fkq_1" value="1"><label for="fkq_1">其他</label>
	</p>
	<p class="t-fkratit">请描述您的反馈（1000字以内）：</p>
	<div class="t-fktxt"><textarea placeholder="请输入您的反馈意见..." name="jianyi" id="feedback_content" onkeyup="strLenCalc($(this), 'checklen', 2000);"></textarea>
		<p><span id="checklen">还可输入 <strong>1000</strong> 个汉字</span></p>
		<div class="t-refk">
		<p>您的反馈，我们已收到，感谢您对好乐买的支持！我们会更加致力于创造最好的用户体验！</p>
		<p style="margin-top:10px"><input type="button" value="确定" onclick="custom_close()" class="t-qd"><input type="button" value="继续反馈" id="t-refk"></p>
	</div></div>
	<p class="t-fkyan">
		验证码：
		
		<img id="validate_img" src="/home/umessage/vcode" onclick="this.src=this.src+'?a=1'">
		<input type="text" name="auth_code" id="auth_code" class="authCodeInput" width="60" height="30">
		<span id="code_error" style="display:none;color:red;">请输入验证码</span>
	</p>
	{{ csrf_field() }}
	<!-- <p class="t-fksubmit" id="timefkp" style="display:none"><span id="timefk"></span>秒后自动关闭本页面</p> -->
	<p class="t-fksubmit"><input type="button" name="" value="提交我的反馈"  id="t-submitFk">
	<!-- <input type="button" name="" value="取消" id="t-deltxt" onclick="custom_close()"></p> -->

	</form>
</div>
<div id="dialog"></div>
@endsection

<script src="/HomeCss/js/jquery-dialog-min.js" type="text/javascript"></script>
@section('js')
<script>
	jQuery(document).ready(function() {
	$("textarea,#auth_code").keypress(function(event){
		if(event.which==13){
			$('#t-submitFk').trigger('click');
		}
	})
})
function strLenCalc(obj, checklen, maxlen) {
　　var v = obj.val(), charlen = 0, maxlen = !maxlen ? 1000 : maxlen, curlen = maxlen, len = v.length;
　　for(var i = 0; i < v.length; i++) {
　　　　if(v.charCodeAt(i) < 0 || v.charCodeAt(i) > 255) {
			curlen -= 1;
		}
	}
	if(curlen >= len) {
		$("#"+checklen).html("还可输入 <strong>"+Math.floor((curlen-len)/2)+"</strong> 个字").css('color', '');
		$("#t-submitFk").removeAttr("disabled");
	}else{
		$("#"+checklen).html("已经超过 <strong>"+Math.ceil((len-curlen)/2)+"</strong> 个字").css('color', '#FF0000');
		$("#t-submitFk").attr("disabled", "disabled");
	}
}
if(typeof String.prototype.trim !== 'function') {
    String.prototype.trim = function() {
    	return this.replace(/^\s+|\s+$/g, '');
  }
}
$(document).ready(function(){
	
	$("#t-submitFk").click(function(){
		var auth_code = $("#auth_code").val().trim();
		if ($('#feedback_content').val() === '') {
			alert('您还没有填写反馈，请填写之后再提交');
			return false;}
		if (auth_code === '') {
			$("#code_error").show();
			return false;
		}
		
			isLocationUrl(auth_code);
		})
	});


function Ajaxsub(){
	var form = new FormData(document.getElementById("feedbackForm"));
 		$.ajaxSetup({
	        headers: {
	            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
	        }
		});

	$.ajax({
                url:"/home/umessage/save",
                type:"post",
                data:form,
                processData:false,
                contentType:false,
                success:function(data){
                    
                },
                error:function(e){
                   
                }
            });        
}

// //关闭网页方法
// function CloseWebPage(){
//  if (navigator.userAgent.indexOf("MSIE") > 0) {
//   if (navigator.userAgent.indexOf("MSIE 6.0") > 0) {
//    window.opener = null;
//    window.close();
//   } else {
//    window.open('', '_top');
//    window.top.close();
//   }
//  }
//  else if (navigator.userAgent.indexOf("Firefox") > 0) {
//   window.location.href = 'about:blank ';
//  } else {
//   window.opener = null;
//   window.open('', '_self', '');
//   window.close();
//  }
// }
	function isLocationUrl(auth_code){
		
		$.ajax({
			url:"/home/umessage/code",
			type:"GET",
			data:{'auth_code':auth_code},
			success:function(data){
				if(data==1){
					$("#code_error").hide();
					Ajaxsub();
					alert('谢谢您！您的反馈我们已经收到,感谢您对好乐买的支持');
					// CloseWebPage();
					window.location.reload(true);
				}else{
			
					$("#code_error").html('请输入正确的验证码');
					$("#code_error").show();
				}
			}
	});
		
	}
</script>
	<script type="text/javascript" src="{{asset('/HomeCss/js/topslide.js')}}"></script>
	<!-- <script type="text/javascript" src="{{asset('/HomeCss/js/jquery.topsuggest.js')}}"></script> -->
	<script type="text/javascript" src="{{asset('/HomeCss/js/scrolltotop.js')}}"></script>
	<script type="text/javascript" src="{{asset('/HomeCss/js/timer.js')}}"></script>
	<!-- <script type="text/javascript" src="{{asset('/HomeCss/js/index.js')}}"></script> -->
	<script type="text/javascript" src="{{asset('/HomeCss/js/traffic.js')}}" async></script>
	<script type="text/javascript" src="{{asset('/HomeCss/js/jquery-1.8.3.min.js')}}"></script>

@endsection

